package com.java46.carera.candidate.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.java46.carera.base.entity.Candidate;
import com.java46.carera.base.entity.JsonResult;
import com.java46.carera.base.mapper.CandidateMapper;
import com.java46.carera.base.util.JsonUtil;
import com.java46.carera.candidate.service.CandidateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName ReservationRecordService
 * @Description 招聘后台controller
 * @Author TriggerWu
 * @Date 2018/8/28 18:56
 * @Vcrsion 1.0
 **/
@Controller
@RequestMapping("/Candi")
public class CandidateController {
    @Autowired
    private CandidateService candidateService;

    /**
     * 分页模糊查询
     * @param keyword
     * @param pageNum
     * @return
     */
    @RequestMapping(value = "queryAll")
    @ResponseBody
    public JsonResult queryAll(String keyword, Integer pageNum){
        PageHelper.startPage(pageNum,5);
        return candidateService.queryAll(keyword,pageNum);
    }
    /**
     * 修改状态
     * @param
     * @return
     */
    @RequestMapping(value = "updateStatus")
    @ResponseBody
    public  JsonResult updateStatus(Integer canId){
        return candidateService.updateByStatus(canId);
    }
    @RequestMapping("/delete")
    @ResponseBody
    public JsonResult deleteCandidateById(Integer canid){
        return candidateService.deleteById(canid);
    }
}
